import { createApp } from 'vue';
import Notification from '@/zdpui/components/modal/Notification.vue';

const NotificationPlugin = {
    install(app) {
        // 创建挂载点
        const mountPoint = document.createElement('div');
        document.body.appendChild(mountPoint);

        // 创建 Vue 实例并挂载通知组件
        const notificationApp = createApp(Notification);
        const notificationInstance = notificationApp.mount(mountPoint);

        // 挂载到 Vue 实例的全局属性
        app.config.globalProperties.$notify = notificationInstance.show;

        // 挂载到 window 对象，以便在普通 JS 中使用
        window.$notify = notificationInstance.show;
    }
};

export default NotificationPlugin;